#include "mainwindow.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QDebug>
#include<QTime>
#include<QDate>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    mtimer=new QTimer();
    connect(this,&MainWindow::signalName,this,&MainWindow::on_pushButton_clicked);
    connect(mtimer,&QTimer::timeout,this,&MainWindow::on_pushButton_clicked);//用计时器来取代按钮发信号
    mtimer->start(3000);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
//    qDebug()<<QTime::currentTime().toString("hh:mm:ss");
//    qDebug()<<QDate::currentDate().toString("yyyy-MM-dd");
    ui->label->setText(QTime::currentTime().toString("hh:mm:ss"));
    ui->label_2->setText(QDate::currentDate().toString("yyyy-MM-dd"));
}
